#pragma once
#include "../infrastructure/display/OLEDDisplay.h"
#include "../infrastructure/mqtt/MQTTManager.h"
#include "../infrastructure/network/HttpManager.h"
#include "../infrastructure/sensors/DHT11Sensor.h"
#include "../infrastructure/wifi/WiFiManager.h"

// WIFI参数
extern const char *SSID;     // WiFi账号
extern const char *PASSWORD; // WiFi密码

// MQTT参数
extern const char *MQTT_HOST; // Mqtt消息服务器地址
extern const int MQTT_PORT;   // Mqtt消息服务器端口
extern const char *DEVICE_NUM;       // clientId组合
extern const char *USER_ID;
extern const char *PRODUCT_ID;
extern const char *MQTT_USERNAME;    // Mqtt消息服务器账号
extern const char *MQTT_PASSWORD;    // Mqtt消息服务器密码
extern const char MQTT_SECURITY[17]; // Mqtt秘钥,16位

// DHT11参数
extern const uint8_t DHT11_PIN; // GPIO25

/**
 * @brief 主业务逻辑类
 * @note 管理整个应用的生命周期
 */
class App {
  public:
    void init(); // 初始化应用
    void run();  // 主循环逻辑

  private:
    // WIFI相关
    WiFiManager _wifi;
    // MQTT相关
    MQTTManager _mqtt;
    //  OLED相关
    OLEDDisplay _oled;
    // HTTP相关
    HttpManager _http;
    // DHT11相关
    DHT11Sensor _dht11;
};